<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>优惠券 - 用户中心 - 拖拽式建站平台</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
        }

        :root {
            --sidebar-width: 240px;
            --header-height: 64px;
            --primary-color: #3498db;
            --secondary-color: #2c3e50;
            --bg-color: #f5f6f7;
            --card-bg: #ffffff;
            --text-primary: #18191c;
            --text-secondary: #61666d;
            --text-muted: #9499a0;
            --border-color: #e3e5e7;
            --success-color: #27ae60;
            --warning-color: #f39c12;
            --danger-color: #e74c3c;
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-primary);
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
        }

        /* 顶部导航栏 */
        .header {
            height: var(--header-height);
            background: var(--card-bg);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            border-bottom: 1px solid var(--border-color);
            z-index: 100;
        }

        .header-left {
            display: flex;
            align-items: center;
        }

        .sidebar-toggle {
            margin-right: 16px;
            cursor: pointer;
            color: var(--text-secondary);
            font-size: 18px;
        }

        .logo {
            font-size: 18px;
            font-weight: 600;
            color: var(--text-primary);
            display: flex;
            align-items: center;
        }

        .logo i {
            margin-right: 10px;
            color: var(--primary-color);
        }

        .header-right {
            display: flex;
            align-items: center;
        }

        .header-action {
            margin-left: 16px;
            color: var(--text-secondary);
            cursor: pointer;
            position: relative;
        }

        .header-action:hover {
            color: var(--primary-color);
        }

        .badge {
            position: absolute;
            top: -5px;
            right: -5px;
            background: var(--danger-color);
            color: white;
            font-size: 11px;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .user-menu {
            display: flex;
            align-items: center;
            margin-left: 20px;
            cursor: pointer;
        }

        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: var(--primary-color);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-left: 12px;
        }

        /* 主内容区域 */
        .main-container {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        /* 侧边栏 */
        .sidebar {
            width: var(--sidebar-width);
            background: var(--card-bg);
            border-right: 1px solid var(--border-color);
            overflow-y: auto;
            transition: all 0.3s ease;
        }

        .sidebar-menu {
            padding: 16px 0;
        }

        .menu-title {
            padding: 10px 20px;
            font-size: 13px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .menu-item {
            display: flex;
            align-items: center;
            padding: 12px 20px;
            color: var(--text-secondary);
            text-decoration: none;
            transition: all 0.3s ease;
            border-left: 3px solid transparent;
        }

        .menu-item:hover {
            background: rgba(52, 152, 219, 0.1);
            color: var(--primary-color);
        }

        .menu-item.active {
            background: rgba(52, 152, 219, 0.1);
            color: var(--primary-color);
            border-left-color: var(--primary-color);
        }

        .menu-item i {
            margin-right: 12px;
            width: 18px;
            text-align: center;
        }

        /* 内容区域 */
        .content {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
        }

        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
        }

        .page-title {
            font-size: 24px;
            font-weight: 600;
        }

        .page-actions .btn {
            margin-left: 10px;
        }

        /* 选项卡样式 */
        .tabs {
            display: flex;
            border-bottom: 1px solid var(--border-color);
            margin-bottom: 20px;
        }

        .tab {
            padding: 12px 24px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            color: var(--text-secondary);
            border-bottom: 2px solid transparent;
            transition: all 0.3s ease;
        }

        .tab:hover {
            color: var(--primary-color);
        }

        .tab.active {
            color: var(--primary-color);
            border-bottom-color: var(--primary-color);
        }

        .tab-badge {
            background: var(--bg-color);
            color: var(--text-secondary);
            padding: 2px 6px;
            border-radius: 10px;
            font-size: 12px;
            margin-left: 6px;
        }

        /* 优惠券卡片样式 */
        .coupons-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
            margin-bottom: 24px;
        }

        .coupon-card {
            background: var(--card-bg);
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            position: relative;
        }

        .coupon-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
        }

        .coupon-header {
            background: linear-gradient(135deg, var(--primary-color), #2c3e50);
            color: white;
            padding: 16px;
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
        }

        .coupon-amount {
            font-size: 28px;
            font-weight: 700;
        }

        .coupon-amount small {
            font-size: 16px;
            font-weight: 500;
        }

        .coupon-type {
            background: rgba(255, 255, 255, 0.2);
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 500;
        }

        .coupon-body {
            padding: 16px;
        }

        .coupon-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--text-primary);
        }

        .coupon-desc {
            font-size: 13px;
            color: var(--text-secondary);
            margin-bottom: 12px;
            line-height: 1.4;
        }

        .coupon-meta {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-bottom: 16px;
        }

        .coupon-meta-item {
            display: flex;
            align-items: center;
            font-size: 13px;
            color: var(--text-secondary);
        }

        .coupon-meta-item i {
            margin-right: 8px;
            width: 16px;
            color: var(--text-muted);
        }

        .coupon-footer {
            padding: 12px 16px;
            border-top: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .coupon-code {
            font-family: 'Courier New', monospace;
            font-weight: 600;
            color: var(--primary-color);
            font-size: 14px;
            letter-spacing: 1px;
        }

        .coupon-status {
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 500;
        }

        .status-available {
            background: rgba(39, 174, 96, 0.1);
            color: var(--success-color);
        }

        .status-used {
            background: rgba(116, 125, 140, 0.1);
            color: var(--text-secondary);
        }

        .status-expired {
            background: rgba(231, 76, 60, 0.1);
            color: var(--danger-color);
        }

        /* 优惠券操作按钮 */
        .coupon-actions {
            display: flex;
            gap: 8px;
        }

        .btn-coupon {
            padding: 6px 12px;
            border-radius: 4px;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
            border: none;
        }

        .btn-use {
            background: var(--primary-color);
            color: white;
        }

        .btn-use:hover {
            background: #2980b9;
        }

        .btn-copy {
            background: transparent;
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
        }

        .btn-copy:hover {
            background: #f5f7fa;
        }

        /* 兑换优惠券区域 */
        .redeem-section {
            background: var(--card-bg);
            border-radius: 4px;
            padding: 20px;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
            margin-bottom: 24px;
        }

        .section-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
        }

        .section-title i {
            margin-right: 8px;
            color: var(--primary-color);
        }

        .redeem-form {
            display: flex;
            gap: 12px;
        }

        .form-input {
            flex: 1;
            padding: 10px 12px;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
        }

        /* 空状态样式 */
        .empty-state {
            text-align: center;
            padding: 40px 20px;
            color: var(--text-muted);
        }

        .empty-state i {
            font-size: 64px;
            margin-bottom: 16px;
            opacity: 0.5;
        }

        .empty-state p {
            font-size: 16px;
            margin-bottom: 24px;
        }

        /* 按钮样式 */
        .btn {
            padding: 8px 16px;
            border: none;
            border-radius: 4px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .btn i {
            margin-right: 6px;
        }

        .btn-primary {
            background: var(--primary-color);
            color: white;
        }

        .btn-primary:hover {
            background: #2980b9;
        }

        .btn-outline {
            background: transparent;
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
        }

        .btn-outline:hover {
            background: #f5f7fa;
        }

        /* 响应式设计 */
        @media (max-width: 992px) {
            .sidebar {
                position: fixed;
                left: -var(--sidebar-width);
                top: var(--header-height);
                bottom: 0;
                z-index: 90;
            }

            .sidebar.open {
                left: 0;
            }

            .overlay {
                position: fixed;
                top: var(--header-height);
                left: 0;
                right: 0;
                bottom: 0;
                background: rgba(0, 0, 0, 0.5);
                z-index: 80;
                display: none;
            }

            .overlay.open {
                display: block;
            }
        }

        @media (max-width: 768px) {
            .coupons-container {
                grid-template-columns: 1fr;
            }

            .redeem-form {
                flex-direction: column;
            }

            .page-header {
                flex-direction: column;
                align-items: flex-start;
            }

            .page-actions {
                margin-top: 16px;
                width: 100%;
                display: flex;
                justify-content: space-between;
            }

            .page-actions .btn {
                margin-left: 0;
                flex: 1;
                margin: 0 5px;
            }

            .tabs {
                overflow-x: auto;
                white-space: nowrap;
            }
        }
    </style>
</head>

<body>
    <!-- 顶部导航栏 -->
    <div class="header">
        <div class="header-left">
            <div class="sidebar-toggle">
                <i class="fas fa-bars"></i>
            </div>
            <div class="logo">
                <i class="fas fa-puzzle-piece"></i>
                拖拽建站平台
            </div>
        </div>

        <div class="header-right">
            <div class="header-action">
                <i class="fas fa-bell"></i>
                <span class="badge">3</span>
            </div>

            <div class="header-action">
                <i class="fas fa-envelope"></i>
                <span class="badge">5</span>
            </div>

            <div class="user-menu">
                <span>张三</span>
                <div class="user-avatar">
                    <i class="fas fa-user"></i>
                </div>
            </div>
        </div>
    </div>

    <!-- 主内容区域 -->
    <div class="main-container">
        <!-- 侧边栏 -->
        <div class="sidebar">
            <div class="sidebar-menu">
                <div class="menu-title">用户中心</div>
                <a href="#" class="menu-item">
                    <i class="fas fa-user-circle"></i>
                    <span>个人信息</span>
                </a>
                <a href="#" class="menu-item">
                    <i class="fas fa-shield-alt"></i>
                    <span>账户安全</span>
                </a>
                <a href="#" class="menu-item">
                    <i class="fas fa-globe"></i>
                    <span>我的网站</span>
                </a>
                <a href="#" class="menu-item">
                    <i class="fas fa-file-alt"></i>
                    <span>我的页面</span>
                </a>

                <div class="menu-title">内容管理</div>
                <a href="#" class="menu-item">
                    <i class="fas fa-newspaper"></i>
                    <span>我的文章</span>
                </a>
                <a href="#" class="menu-item">
                    <i class="fas fa-box"></i>
                    <span>我的产品</span>
                </a>
                <a href="#" class="menu-item">
                    <i class="fas fa-images"></i>
                    <span>我的媒体</span>
                </a>

                <div class="menu-title">交易管理</div>
                <a href="#" class="menu-item">
                    <i class="fas fa-credit-card"></i>
                    <span>我的订单</span>
                </a>
                <a href="#" class="menu-item">
                    <i class="fas fa-money-bill-wave"></i>
                    <span>支付记录</span>
                </a>
                <a href="#" class="menu-item active">
                    <i class="fas fa-gift"></i>
                    <span>优惠券</span>
                </a>

                <div class="menu-title">消息中心</div>
                <a href="#" class="menu-item">
                    <i class="fas fa-bell"></i>
                    <span>消息通知</span>
                </a>
                <a href="#" class="menu-item">
                    <i class="fas fa-comments"></i>
                    <span>站内信</span>
                </a>
            </div>
        </div>

        <!-- 内容区域 -->
        <div class="content">
            <div class="page-header">
                <h1 class="page-title">优惠券</h1>
                <div class="page-actions">
                    <button class="btn btn-outline">
                        <i class="fas fa-history"></i> 领取记录
                    </button>
                    <button class="btn btn-primary">
                        <i class="fas fa-sync-alt"></i> 刷新
                    </button>
                </div>
            </div>

            <!-- 兑换优惠券区域 -->
            <div class="redeem-section">
                <div class="section-title">
                    <i class="fas fa-ticket-alt"></i>
                    兑换优惠券
                </div>
                <div class="redeem-form">
                    <input type="text" class="form-input" placeholder="请输入优惠券代码">
                    <button class="btn btn-primary">
                        <i class="fas fa-exchange-alt"></i> 兑换
                    </button>
                </div>
            </div>

            <!-- 选项卡 -->
            <div class="tabs">
                <div class="tab active" data-tab="available">
                    可用优惠券 <span class="tab-badge">3</span>
                </div>
                <div class="tab" data-tab="used">
                    已使用 <span class="tab-badge">2</span>
                </div>
                <div class="tab" data-tab="expired">
                    已过期 <span class="tab-badge">1</span>
                </div>
            </div>

            <!-- 优惠券列表 - 可用 -->
            <div class="tab-content" id="available-coupons">
                <div class="coupons-container">
                    <!-- 优惠券卡片 1 -->
                    <div class="coupon-card">
                        <div class="coupon-header">
                            <div class="coupon-amount">¥50 <small>满300可用</small></div>
                            <div class="coupon-type">折扣券</div>
                        </div>
                        <div class="coupon-body">
                            <div class="coupon-title">新用户专属优惠</div>
                            <div class="coupon-desc">适用于所有产品，不限使用次数</div>
                            <div class="coupon-meta">
                                <div class="coupon-meta-item">
                                    <i class="far fa-calendar-alt"></i>
                                    有效期至: 2023-12-31
                                </div>
                                <div class="coupon-meta-item">
                                    <i class="fas fa-tag"></i>
                                    适用: 全部产品
                                </div>
                            </div>
                        </div>
                        <div class="coupon-footer">
                            <div class="coupon-code">NEWUSER50</div>
                            <span class="coupon-status status-available">可用</span>
                        </div>
                        <div class="coupon-actions">
                            <button class="btn-coupon btn-use">立即使用</button>
                            <button class="btn-coupon btn-copy">复制代码</button>
                        </div>
                    </div>

                    <!-- 优惠券卡片 2 -->
                    <div class="coupon-card">
                        <div class="coupon-header">
                            <div class="coupon-amount">8 <small>折</small></div>
                            <div class="coupon-type">折扣券</div>
                        </div>
                        <div class="coupon-body">
                            <div class="coupon-title">企业用户专享</div>
                            <div class="coupon-desc">适用于企业版套餐，最高可省¥500</div>
                            <div class="coupon-meta">
                                <div class="coupon-meta-item">
                                    <i class="far fa-calendar-alt"></i>
                                    有效期至: 2023-10-31
                                </div>
                                <div class="coupon-meta-item">
                                    <i class="fas fa-tag"></i>
                                    适用: 企业版套餐
                                </div>
                            </div>
                        </div>
                        <div class="coupon-footer">
                            <div class="coupon-code">ENTERPRISE20</div>
                            <span class="coupon-status status-available">可用</span>
                        </div>
                        <div class="coupon-actions">
                            <button class="btn-coupon btn-use">立即使用</button>
                            <button class="btn-coupon btn-copy">复制代码</button>
                        </div>
                    </div>

                    <!-- 优惠券卡片 3 -->
                    <div class="coupon-card">
                        <div class="coupon-header">
                            <div class="coupon-amount">¥100 <small>无门槛</small></div>
                            <div class="coupon-type">代金券</div>
                        </div>
                        <div class="coupon-body">
                            <div class="coupon-title">周年庆回馈</div>
                            <div class="coupon-desc">无门槛使用，可直接抵扣订单金额</div>
                            <div class="coupon-meta">
                                <div class="coupon-meta-item">
                                    <i class="far fa-calendar-alt"></i>
                                    有效期至: 2023-11-15
                                </div>
                                <div class="coupon-meta-item">
                                    <i class="fas fa-tag"></i>
                                    适用: 全部订单
                                </div>
                            </div>
                        </div>
                        <div class="coupon-footer">
                            <div class="coupon-code">ANNIVERSARY100</div>
                            <span class="coupon-status status-available">可用</span>
                        </div>
                        <div class="coupon-actions">
                            <button class="btn-coupon btn-use">立即使用</button>
                            <button class="btn-coupon btn-copy">复制代码</button>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 优惠券列表 - 已使用 -->
            <div class="tab-content" id="used-coupons" style="display: none;">
                <div class="coupons-container">
                    <!-- 已使用的优惠券卡片 -->
                    <div class="coupon-card">
                        <div class="coupon-header" style="opacity: 0.7;">
                            <div class="coupon-amount">¥30 <small>满200可用</small></div>
                            <div class="coupon-type">折扣券</div>
                        </div>
                        <div class="coupon-body">
                            <div class="coupon-title">月度促销优惠</div>
                            <div class="coupon-desc">适用于所有产品，每月限用一次</div>
                            <div class="coupon-meta">
                                <div class="coupon-meta-item">
                                    <i class="far fa-calendar-alt"></i>
                                    已使用: 2023-08-20
                                </div>
                                <div class="coupon-meta-item">
                                    <i class="fas fa-tag"></i>
                                    适用: 全部产品
                                </div>
                            </div>
                        </div>
                        <div class="coupon-footer">
                            <div class="coupon-code">MONTHLY30</div>
                            <span class="coupon-status status-used">已使用</span>
                        </div>
                    </div>

                    <div class="coupon-card">
                        <div class="coupon-header" style="opacity: 0.7;">
                            <div class="coupon-amount">¥80 <small>满500可用</small></div>
                            <div class="coupon-type">代金券</div>
                        </div>
                        <div class="coupon-body">
                            <div class="coupon-title">夏季特惠</div>
                            <div class="coupon-desc">夏季促销活动专属优惠</div>
                            <div class="coupon-meta">
                                <div class="coupon-meta-item">
                                    <i class="far fa-calendar-alt"></i>
                                    已使用: 2023-07-15
                                </div>
                                <div class="coupon-meta-item">
                                    <i class="fas fa-tag"></i>
                                    适用: 全部订单
                                </div>
                            </div>
                        </div>
                        <div class="coupon-footer">
                            <div class="coupon-code">SUMMER80</div>
                            <span class="coupon-status status-used">已使用</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 优惠券列表 - 已过期 -->
            <div class="tab-content" id="expired-coupons" style="display: none;">
                <div class="coupons-container">
                    <!-- 已过期的优惠券卡片 -->
                    <div class="coupon-card">
                        <div class="coupon-header" style="opacity: 0.7;">
                            <div class="coupon-amount">¥20 <small>无门槛</small></div>
                            <div class="coupon-type">代金券</div>
                        </div>
                        <div class="coupon-body">
                            <div class="coupon-title">注册欢迎礼</div>
                            <div class="coupon-desc">新用户注册赠送，无门槛使用</div>
                            <div class="coupon-meta">
                                <div class="coupon-meta-item">
                                    <i class="far fa-calendar-alt"></i>
                                    已过期: 2023-06-30
                                </div>
                                <div class="coupon-meta-item">
                                    <i class="fas fa-tag"></i>
                                    适用: 全部订单
                                </div>
                            </div>
                        </div>
                        <div class="coupon-footer">
                            <div class="coupon-code">WELCOME20</div>
                            <span class="coupon-status status-expired">已过期</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 移动端遮罩层 -->
    <div class="overlay"></div>

    <script>
        document.addEventListener('DOMContentLoaded', function () {
            // 侧边栏切换
            const sidebarToggle = document.querySelector('.sidebar-toggle');
            const sidebar = document.querySelector('.sidebar');
            const overlay = document.querySelector('.overlay');

            sidebarToggle.addEventListener('click', function () {
                sidebar.classList.toggle('open');
                overlay.classList.toggle('open');
            });

            overlay.addEventListener('click', function () {
                sidebar.classList.remove('open');
                overlay.classList.remove('open');
            });

            // 选项卡切换功能
            const tabs = document.querySelectorAll('.tab');
            const tabContents = {
                'available': document.getElementById('available-coupons'),
                'used': document.getElementById('used-coupons'),
                'expired': document.getElementById('expired-coupons')
            };

            tabs.forEach(tab => {
                tab.addEventListener('click', function () {
                    const tabName = this.getAttribute('data-tab');

                    // 更新选项卡状态
                    tabs.forEach(t => t.classList.remove('active'));
                    this.classList.add('active');

                    // 更新内容显示
                    Object.keys(tabContents).forEach(key => {
                        if (key === tabName) {
                            tabContents[key].style.display = 'block';
                        } else {
                            tabContents[key].style.display = 'none';
                        }
                    });
                });
            });

            // 复制优惠券代码功能
            const copyButtons = document.querySelectorAll('.btn-copy');
            copyButtons.forEach(button => {
                button.addEventListener('click', function () {
                    const couponCode = this.closest('.coupon-card').querySelector('.coupon-code').textContent;
                    navigator.clipboard.writeText(couponCode).then(() => {
                        const originalText = this.textContent;
                        this.textContent = '已复制!';
                        setTimeout(() => {
                            this.textContent = originalText;
                        }, 2000);
                    }).catch(err => {
                        console.error('复制失败:', err);
                    });
                });
            });

            // 使用优惠券功能
            const useButtons = document.querySelectorAll('.btn-use');
            useButtons.forEach(button => {
                button.addEventListener('click', function () {
                    const couponCard = this.closest('.coupon-card');
                    const couponCode = couponCard.querySelector('.coupon-code').textContent;
                    alert(`即将使用优惠券: ${couponCode}\n将跳转到使用页面...`);
                    // 这里可以添加跳转到使用页面的代码
                });
            });

            // 兑换优惠券功能
            const redeemButton = document.querySelector('.redeem-form .btn');
            redeemButton.addEventListener('click', function () {
                const codeInput = document.querySelector('.redeem-form .form-input');
                const code = codeInput.value.trim();

                if (code === '') {
                    alert('请输入优惠券代码');
                    return;
                }

                // 模拟兑换过程
                alert(`正在兑换优惠券: ${code}`);
                codeInput.value = '';

                // 这里可以添加实际的兑换逻辑
                setTimeout(() => {
                    alert('兑换成功！优惠券已添加到您的账户。');
                }, 1000);
            });
        });
    </script>
</body>

</html>